const fs = require("fs")
const path = require("path")

//写日志
function writelog(writeStream,log){
  writeStream.write(log+'\n')
}

function createWriteStream(filename){
  const fullfilename = path.join(__dirname,'../','logs/',filename)
  const ws = fs.createWriteStream(fullfilename,{flags:'a'})
  return ws
}
const accessWriteStream = createWriteStream("access.log")

//写访问日志
function access(log){
  writelog(accessWriteStream,log)
}

module.exports={
  access
}